/*
 * @Author: YuanSong 
 * @Date: 2021-11-25 22:02:08 
 * @Last Modified by: YuanSong
 * @Last Modified time: 2021-12-01 11:17:57
 */
import React from 'react';
import NormalPage from '@components/NormalPage';
import LoginBox from '@/components/LoginBox/index'
import { withRouter,RouteComponentProps } from "react-router-dom";
import { connect } from 'react-redux';
import { AppState } from '@redux/reducers';
import { requestLoginRegister } from '@redux/actions/user';
import { bindActionCreators } from 'redux';
import {IGlobalReduceState} from  "@/redux/reducers/global";
type IProps =  RouteComponentProps  & IGlobalReduceState & {
  requestLoginRegister:typeof requestLoginRegister;
};
class Login extends React.Component<IProps> {
  constructor(props:any){
    super(props)
  }
  componentDidMount(){
    console.log('进入了login')
    // this.loginRegister();
  }
  private loginRegister(){
    const passwordLogin = {
      phoneNo: '13691841422',
      password: '12345',
      
    };
      // this.props.requestLoginRegister(passwordLogin, () => {
        // this.props.history.goBack();
      // });
    
  }
  render() {
    
    return (
      
      <NormalPage showHeader={true} showRightNavigation={false}>
        <div className="Login-Wrapper">
          <LoginBox requestLoginRegister={this.props.requestLoginRegister}/>
        </div>
    
      </NormalPage>
    
      
      
    );
  }
}

export default connect(
    (state:AppState) => state.global,
    (dispatch) =>
        bindActionCreators(
            {
                requestLoginRegister
            },
            dispatch
        ) 
)(withRouter(Login));